import 'package:webviewx/webviewx.dart';
import 'package:flutter/material.dart';

class WebViewPage extends StatefulWidget {
  const WebViewPage({
    super.key,
    required this.url,
  });

  final String url;

  @override
  _WebViewPageState createState() => _WebViewPageState();
}

class _WebViewPageState extends State<WebViewPage> {
  late WebViewXController webviewController;

  @override
  void dispose() {
    webviewController.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return WebViewX(
      initialContent: widget.url,
      initialSourceType: SourceType.url,
      height: 1080,
      width: 1920,
      onWebViewCreated: (controller) => webviewController = controller,
      onPageFinished: (url) {},
      onPageStarted: (url) {},
      onWebResourceError: (error) {},
    );
  }
}
